import Vue from 'vue'
import VueRouter from 'vue-router'


// configuration
Vue.use(VueRouter);

// import component

// 登录界面
const login = () => import("@/page/login/index");
// 内容部分
const articleManage = () => import("@/page/content/manage-article");
const imageManage = () => import("@/page/content/manage-image");
const commentManage = () => import("@/page/content/manage-comment");
const postArticle = () => import("@/page/content/post-article");
// 首页
const index = () => import("@/page/dashboard/index.vue");
// 运营
const categoryManage = () => import("@/page/operation/manage-category.vue");
const loop = () => import("@/page/operation/loop.vue");
// 设置
const webSizeInfo = () => import("@/page/settings/websize-info.vue");
const friendLink = () => import("@/page/settings/friend-link.vue");
const info = () => import("@/page/settings/info.vue");
const email = () => import("@/page/settings/email.vue");
// 用户
const list = () => import("@/page/user/list.vue");
const restPassword = () => import("@/page/user/rest-password.vue");

const baseView = () => import("@/layout/base-view.vue");
const rightView = () => import("@/layout/right-content");

export const routes = [
    {
        path: '/',
        component: baseView,
        // 默认首页
        redirect: "/index",
        hidden: false,
        children: [{
            path: '/index',
            name: '首页',
            icon: 'el-icon-s-home',
            hidden: false,
            component: index,
            requireLogin: true,
        }, {
            path: '/content',
            name: '内容',
            icon: 'el-icon-tickets',
            hidden: false,
            component: rightView,
            children: [{
                path: 'post-article',
                name: '发表文章',
                icon: 'el-icon-edit-outline',
                hidden: false,
                component: postArticle
            }, {
                path: 'manage-article',
                name: '文章管理',
                icon: 'el-icon-document',
                hidden: false,
                component: articleManage
            }, {
                path: 'manage-image',
                name: '图片管理',
                icon: 'el-icon-picture-outline',
                hidden: false,
                component: imageManage
            }, {
                path: 'manage-comment',
                name: '评论管理',
                icon: 'el-icon-chat-line-round',
                hidden: false,
                component: commentManage
            }]
        }, {
            path: '/user',
            name: '用户',
            icon: 'el-icon-user',
            hidden: false,
            component: rightView,
            children: [{
                path: 'list',
                name: '用户列表',
                icon: 'el-icon-user',
                hidden: false,
                component: list
            }, {
                path: 'rest-password',
                name: '修改密码',
                icon: 'el-icon-more-outline',
                hidden: false,
                component: restPassword
            }]
        }, {
            path: '/operation',
            name: '运营',
            icon: 'el-icon-s-platform',
            hidden: false,
            component: rightView,
            children: [{
                path: 'loop',
                name: '轮播图',
                icon: 'el-icon-picture-outline-round',
                hidden: false,
                component: loop
            }, {
                path: 'category',
                name: '分类',
                icon: 'el-icon-s-fold',
                hidden: false,
                component: categoryManage
            }]
        }, {
            path: '/settings',
            name: '设置',
            icon: 'el-icon-setting',
            hidden: false,
            component: rightView,
            children: [{
                path: 'email',
                name: '邮箱',
                icon: 'el-icon-message',
                hidden: false,
                component: email
            }, {
                path: 'web-size-info',
                name: '网站信息',
                icon: 'el-icon-s-tools',
                hidden: false,
                component: webSizeInfo
            }, {
                path: 'friend-link',
                name: '友情链接',
                icon: 'el-icon-user-solid',
                hidden: false,
                component: friendLink
            }, {
                path: 'info',
                name: '用户信息',
                icon: 'el-icon-warning-outline',
                hidden: false,
                component: info
            }]
        }]
    },
    {
        path: '/login',
        component: login,
        requireLogin: false
    }
];

const router = new VueRouter({
    routes: routes
});

export default router;